/*
 * Copyright [2022] [https://www.xiaonuo.vip]
 *
 * Snowy采用APACHE LICENSE 2.0开源协议，您在使用过程中，需要注意以下几点：
 *
 * 1.请不要删除和修改根目录下的LICENSE文件。
 * 2.请不要删除和修改Snowy源码头部的版权声明。
 * 3.本项目代码可免费商业使用，商业使用请保留源码和相关描述文件的项目出处，作者声明等。
 * 4.分发源码时候，请注明软件出处 https://www.xiaonuo.vip
 * 5.不可二次分发开源参与同类竞品，如有想法可联系团队xiaonuobase@qq.com商议合作。
 * 6.若您的项目无法满足以上几点，需要更多功能代码，获取Snowy商业授权许可，请在官网购买授权，地址为 https://www.xiaonuo.vip
 */
package vip.xiaonuo.biz.modular.hiddenreport.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import vip.xiaonuo.biz.modular.hiddenreport.entity.ReportAuditRecord;
import vip.xiaonuo.biz.modular.hiddenreport.param.*;
import vip.xiaonuo.common.annotation.CommonLog;
import vip.xiaonuo.common.pojo.CommonResult;
import vip.xiaonuo.common.pojo.CommonValidList;
import vip.xiaonuo.biz.modular.hiddenreport.entity.HiddenReport;
import vip.xiaonuo.biz.modular.hiddenreport.service.HiddenReportService;

import javax.annotation.Resource;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;

/**
 * 隐患上报信息控制器
 *
 * @author H
 * @date  2025/10/17 16:36
 */
@Api(tags = "隐患上报信息控制器")
@ApiSupport(author = "SNOWY_TEAM", order = 1)
@RestController
@Validated
public class HiddenReportController {

    @Resource
    private HiddenReportService hiddenReportService;

    /**
     * 获取隐患上报信息分页
     *
     * @author H
     * @date  2025/10/17 16:36
     */
    @ApiOperationSupport(order = 1)
    @ApiOperation("获取隐患上报信息分页")
    @SaCheckPermission("/biz/hiddenreport/page")
    @GetMapping("/biz/hiddenreport/page")
    public CommonResult<Page<HiddenReport>> page(HiddenReportPageParam hiddenReportPageParam) {
        return CommonResult.data(hiddenReportService.page(hiddenReportPageParam));
    }

    /**
     * 添加隐患上报信息
     *
     * @author H
     * @date  2025/10/17 16:36
     */
    @ApiOperationSupport(order = 2)
    @ApiOperation("添加隐患上报信息")
    @CommonLog("添加隐患上报信息")
    @SaCheckPermission("/biz/hiddenreport/add")
    @PostMapping("/biz/hiddenreport/add")
    public CommonResult<String> add(@RequestBody @Valid HiddenReportAddParam hiddenReportAddParam) {
        hiddenReportService.add(hiddenReportAddParam);
        return CommonResult.ok();
    }

    /**
     * 编辑隐患上报信息
     *
     * @author H
     * @date  2025/10/17 16:36
     */
    @ApiOperationSupport(order = 3)
    @ApiOperation("编辑隐患上报信息")
    @CommonLog("编辑隐患上报信息")
    @SaCheckPermission("/biz/hiddenreport/edit")
    @PostMapping("/biz/hiddenreport/edit")
    public CommonResult<String> edit(@RequestBody @Valid HiddenReportEditParam hiddenReportEditParam) {
        hiddenReportService.edit(hiddenReportEditParam);
        return CommonResult.ok();
    }

    /**
     * 删除隐患上报信息
     *
     * @author H
     * @date  2025/10/17 16:36
     */
    @ApiOperationSupport(order = 4)
    @ApiOperation("删除隐患上报信息")
    @CommonLog("删除隐患上报信息")
    @SaCheckPermission("/biz/hiddenreport/delete")
    @PostMapping("/biz/hiddenreport/delete")
    public CommonResult<String> delete(@RequestBody @Valid @NotEmpty(message = "集合不能为空")
                                                   CommonValidList<HiddenReportIdParam> hiddenReportIdParamList) {
        hiddenReportService.delete(hiddenReportIdParamList);
        return CommonResult.ok();
    }

    /**
     * 获取隐患上报信息详情
     *
     * @author H
     * @date  2025/10/17 16:36
     */
    @ApiOperationSupport(order = 5)
    @ApiOperation("获取隐患上报信息详情")
    @SaCheckPermission("/biz/hiddenreport/detail")
    @GetMapping("/biz/hiddenreport/detail")
    public CommonResult<HiddenReport> detail(@Valid HiddenReportIdParam hiddenReportIdParam) {
        return CommonResult.data(hiddenReportService.detail(hiddenReportIdParam));
    }

    /**
     * 分配核实人
     *
     * @author H
     * @date  2025/10/17 16:36
     */
    @ApiOperationSupport(order = 6)
    @ApiOperation("分配核实人")
    @CommonLog("分配核实人")
    @PostMapping("/biz/hiddenreport/allocateVerifyUser")
    public CommonResult<String> allocateVerifyUser(@RequestBody @Valid HiddenReportAllocateParam hiddenReportAllocateParam) {
        hiddenReportService.allocateVerifyUser(hiddenReportAllocateParam);
        return CommonResult.ok();
    }

    /**
     * 核实隐患
     *
     * @author H
     * @date  2025/10/17 16:36
     */
    @ApiOperationSupport(order = 7)
    @ApiOperation("核实隐患")
    @CommonLog("核实隐患")
    @PostMapping("/biz/hiddenreport/verifyHidden")
    public CommonResult<String> verifyHidden(@RequestBody @Valid HiddenReportVerifyParam hiddenReportVerifyParam) {
        hiddenReportService.verifyHidden(hiddenReportVerifyParam);
        return CommonResult.ok();
    }

    /**
     * 隐患定级
     *
     * @author H
     * @date  2025/10/17 16:36
     */
    @ApiOperationSupport(order = 8)
    @ApiOperation("隐患定级")
    @CommonLog("隐患定级")
    @PostMapping("/biz/hiddenreport/mgrAudit")
    public CommonResult<String> mgrAudit(@RequestBody @Valid HiddenReportMgrAuditParam hiddenReportMgrAuditParam) {
        hiddenReportService.mgrAudit(hiddenReportMgrAuditParam);
        return CommonResult.ok();
    }

    /**
     * 监督站站长审核
     *
     * @author H
     * @date  2025/10/17 16:36
     */
    @ApiOperationSupport(order = 9)
    @ApiOperation("监督站站长审核")
    @CommonLog("监督站站长审核")
    @PostMapping("/biz/hiddenreport/superviseAudit")
    public CommonResult<String> superviseAudit(@RequestBody @Valid HiddenReportSuperviseAuditParam hiddenReportSuperviseAuditParam) {
        hiddenReportService.superviseAudit(hiddenReportSuperviseAuditParam);
        return CommonResult.ok();
    }

    /**
     * 业务部门主任审核
     *
     * @author H
     * @date  2025/10/17 16:36
     */
    @ApiOperationSupport(order = 10)
    @ApiOperation("业务部门主任审核")
    @CommonLog("业务部门主任审核")
    @PostMapping("/biz/hiddenreport/bizAudit")
    public CommonResult<String> bizAudit(@RequestBody @Valid HiddenReportBizAuditParam hiddenReportBizAuditParam) {
        hiddenReportService.bizAudit(hiddenReportBizAuditParam);
        return CommonResult.ok();
    }

    /**
     * 质安环部长审核
     *
     * @author H
     * @date  2025/10/17 16:36
     */
    @ApiOperationSupport(order = 11)
    @ApiOperation("质安环部长审核")
    @CommonLog("质安环部长审核")
    @PostMapping("/biz/hiddenreport/safetyAudit")
    public CommonResult<String> safetyAudit(@RequestBody @Valid HiddenReportSafetyAuditParam hiddenReportSafetyAuditParam) {
        hiddenReportService.safetyAudit(hiddenReportSafetyAuditParam);
        return CommonResult.ok();
    }

    /**
     * 分管领导审核
     *
     * @author H
     * @date  2025/10/17 16:36
     */
    @ApiOperationSupport(order = 12)
    @ApiOperation("分管领导审核")
    @CommonLog("分管领导审核")
    @PostMapping("/biz/hiddenreport/chargeAudit")
    public CommonResult<String> chargeAudit(@RequestBody @Valid HiddenReportChargeAuditParam hiddenReportChargeAuditParam) {
        hiddenReportService.chargeAudit(hiddenReportChargeAuditParam);
        return CommonResult.ok();
    }

    /**
     * 主要领导审核
     *
     * @author H
     * @date  2025/10/17 16:36
     */
    @ApiOperationSupport(order = 13)
    @ApiOperation("主要领导审核")
    @CommonLog("主要领导审核")
    @PostMapping("/biz/hiddenreport/mainAudit")
    public CommonResult<String> mainAudit(@RequestBody @Valid HiddenReportMainAuditParam hiddenReportMainAuditParam) {
        hiddenReportService.mainAudit(hiddenReportMainAuditParam);
        return CommonResult.ok();
    }

    /**
     * 获取隐患上报信息分页-待审核
     *
     * @author H
     * @date  2025/10/17 16:36
     */
    @ApiOperationSupport(order = 14)
    @ApiOperation("获取隐患上报信息分页-待审核")
    @GetMapping("/biz/hiddenreport/waitAuditPage")
    public CommonResult<Page<HiddenReport>> waitAuditPage(HiddenReportPageParam hiddenReportPageParam) {
        return CommonResult.data(hiddenReportService.waitAuditPage(hiddenReportPageParam));
    }

    /**
     * 获取隐患上报审核记录分页
     *
     * @author H
     * @date  2025/10/17 16:36
     */
    @ApiOperationSupport(order = 15)
    @ApiOperation("获取隐患上报审核记录分页")
    @GetMapping("/biz/hiddenreport/pageAuditRecord")
    public CommonResult<Page<ReportAuditRecord>> pageAuditRecord(HiddenReportRecordPageParam hiddenReportRecordPageParam) {
        return CommonResult.data(hiddenReportService.pageAuditRecord(hiddenReportRecordPageParam));
    }

    /**
     * 发放奖励
     *
     * @author H
     * @date  2025/11/17 16:36
     */
    @ApiOperationSupport(order = 16)
    @ApiOperation("发放奖励")
    @CommonLog("发放奖励")
    @PostMapping("/biz/hiddenreport/issueReward")
    public CommonResult<String> issueReward(@RequestBody @Valid HiddenReportRewardParam hiddenReportRewardParam) {
        hiddenReportService.issueReward(hiddenReportRewardParam);
        return CommonResult.ok();
    }

    /**
     * 获取隐患上报信息分页
     *
     * @author H
     * @date  2025/10/17 16:36
     */
    @ApiOperationSupport(order = 17)
    @ApiOperation("获取待转换盯防任务隐患列表")
    @GetMapping("/biz/hiddenreport/waitTaskPage")
    public CommonResult<Page<HiddenReport>> waitTaskPage(HiddenReportPageParam hiddenReportPageParam) {
        return CommonResult.data(hiddenReportService.waitTaskPage(hiddenReportPageParam));
    }
}
